home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
ShapeShifter
/
VideoDrivers
/
SD64evd
/
SD64evd_TEST.asm
< prev
next >
Wrap
Assembly Source File
|
1996-06-01
|
8KB
|
470 lines
*
* SD64evd_TEST.asm - ShapeShifter external video driver for PiccoloSD64
* *********** ONLY FOR TESTING PURPOSE *************
*
* $VER: SD64evd_TEST.asm 1.0 (20.05.96)
*
* By Francesco Doro (fdoro@gpnet.it)
*
incdir "INCLUDE_I:"
INCLUDE "exec/types.i"
INCLUDE "exec/macros.i"
INCLUDE "exec/memory.i"
INCLUDE "intuition/intuition.i"
INCLUDE "utility/tagitem.i"
INCLUDE "exec/alerts.i"
INCLUDE "shapeextvideo.i"
*
* Definition of our private context structure for storing local variables
*
STRUCTURE MyContext,0
APTR conIntBase
APTR conGfxBase
APTR conDOSBase
APTR conExpBase
APTR conScreen ;The screen
APTR conViewPort ;The screen's ViewPort
APTR conBitMap ;The screen's RastPort
LONG conBytesPerRow
APTR conDisplayMem ;Display base in SD64 memory
APTR conSD64reg ;Base of SD64 registers
WORD conVideoMode ;Video mode (VMODE_*)
LABEL MyContext_SIZEOF
*
* This is the driver header
*
EVHEADER DriverTags
*
* The header tags that describe the driver and provide pointers to
* the driver's routines
*
DriverTags dc.l SHEV_Level,1 ;Interface level 1
dc.l SHEV_Version,1
dc.l SHEV_Revision,0
dc.l SHEV_Name,DriverName
dc.l SHEV_ID,DriverID
dc.l SHEV_Author,DriverAuthor
dc.l SHEV_OpenScreen,MyOpenScreen
dc.l SHEV_CloseScreen,MyCloseScreen
dc.l TAG_END,0
DriverName dc.b "PiccoloSD64 TEST 24 bit Driver",0
CNOP 0,4
DriverID dc.b '$VER: SD64evd_TEST 1.0'
dc.b ' by Francesco Doro (20.05.96)',13,10,0
CNOP 0,4
DriverAuthor dc.b "Francesco Doro (fdoro@gpnet.it)",0
CNOP 0,4
*
* The OpenScreen routine
* a0: Taglist with input parameters
* a1: Taglist with output parameters
* a6: Base of utility.library
*
MyOpenScreen movem.l d2-d7/a2-a6,-(sp)
move.l a0,a4 ;a4: Input taglist
move.l a1,a5 ;a5: Output taglist
move.l a6,d7 ;d7: UtilityBase
; Allocate memory for context
move.l 4,a6
move.l #MyContext_SIZEOF,d0
move.l #$00010001,d1
jsr -684(a6) :AllocVec
tst.l d0
beq OpenFailed1
move.l d0,a2 ;a2: Context
; Open intuition.library
move.l 4,a6
lea IntName(pc),a1
moveq #37,d0
jsr -552(a6) ;OpenLibrary
move.l d0,conIntBase(a2)
beq OpenFailed2
; Open graphics.library
move.l 4,a6
lea GfxName(pc),a1
moveq #37,d0
jsr -552(a6) ;OpenLibrary
move.l d0,conGfxBase(a2)
beq OpenFailed3
; Open dos.library
move.l 4,a6
lea DOSName(pc),a1
moveq #37,d0
jsr -552(a6) ;OpenLibrary
move.l d0,conDOSBase(a2)
beq OpenFailed4
; Open expansion.library
move.l 4,a6
lea ExpName(pc),a1
moveq #0,d0
jsr -552(a6) ;OpenLibrary
move.l d0,conExpBase(a2)
beq OpenFailed12
; Check board and get video memory address
move.l conExpBase(a2),a6
suba.l a0,a0
move.l #$893,d0
moveq #10,d1
jsr -72(a6) ;FindConfigDev
tst.l d0
beq OpenFailed13
move.l d0,a0
move.l $20(a0),d0
move.l d0,conDisplayMem(a2)
beq OpenFailed13
move.l conExpBase(a2),a6
suba.l a0,a0
move.l #$893,d0
moveq #11,d1
jsr -72(a6) ;FindConfigDev
tst.l d0
beq OpenFailed13
move.l d0,a0
move.l $20(a0),d0
move.l d0,conSD64reg(a2)
beq OpenFailed13
; Store context pointer in output taglist
move.l d7,a6
move.l a5,a0
move.l #SHEV_Context,d0
jsr -30(a6) ;FindTagItem
move.l d0,a0
move.l a2,ti_Data(a0)
; Get video mode and set the refresh type and screen depth accordingly
move.l d7,a6
move.l a4,a0
move.l #SHEV_VideoMode,d0
jsr -36(a6) ;GetTagData
move.w d0,conVideoMode(a2)
cmp.l #VMODE_24BIT,d0
bne OpenFailed5
move.l a5,a0
move.l #SHEV_RefreshType,d0
jsr -30(a6) ;FindTagItem
tst.l d0
beq OpenFailed6
move.l d0,a1
move.l #RTYPE_NONE,ti_Data(a1) ;no refresh
move.l #24,ScrDepth
; Extract screen parameters from input taglist
move.l d7,a6
move.l a4,a0
move.l #SHEV_ScreenX,d0
moveq #0,d1
jsr -36(a6) ;GetTagData
move.l d0,ScrWidth
lsl.l #2,d0
move.l d0,conBytesPerRow(a2)
move.l a4,a0
move.l #SHEV_ScreenY,d0
moveq #0,d1
jsr -36(a6) ;GetTagData
move.l d0,ScrHeight
move.l a4,a0
move.l #SHEV_DisplayID,d0
moveq #0,d1
jsr -36(a6) ;GetTagData
move.l d0,ScrDisplayID
move.l a4,a0
move.l #SHEV_OverscanType,d0
moveq #OSCAN_TEXT,d1
jsr -36(a6) ;GetTagData
move.l d0,ScrOverscan
; Open the screen and store pointer in output taglist
move.l conIntBase(a2),a6
sub.l a0,a0
lea ScreenTags,a1
jsr -612(a6) ;OpenScreenTagList
move.l d0,a3 ;a3: Screen
move.l d0,conScreen(a2)
beq OpenFailed9
ScreenOpened move.l d7,a6
move.l a5,a0
move.l #SHEV_Screen,d0
jsr -30(a6) ;FindTagItem
move.l d0,a0
move.l a3,ti_Data(a0)
; Extract our private data
lea sc_ViewPort(a3),a0
move.l a0,conViewPort(a2)
lea sc_RastPort(a3),a0
move.l rp_BitMap(a0),conBitMap(a2)
; Extract all the other data that the caller wants
move.l d7,a6
move.l a5,a0
move.l #SHEV_ScreenBase,d0
jsr -30(a6) ;FindTagItem
tst.l d0
beq OpenFailed10
move.l d0,a1
move.l conDisplayMem(a2),ti_Data(a1)
move.l d7,a6
move.l a5,a0
move.l #SHEV_BytesPerRow,d0
jsr -30(a6) ;FindTagItem
tst.l d0
beq OpenFailed11
move.l d0,a1
move.l conBytesPerRow(a2),ti_Data(a1)
; Everything is OK
movem.l (sp)+,d2-d7/a2-a6
moveq #0,d0
rts
; An error occurred
OpenFailed movem.l (sp)+,d2-d7/a2-a6
moveq #-1,d0
rts
OpenFailed1
bra.s OpenFailed
OpenFailed2
bra.s OpenFailed
OpenFailed3
bra.s OpenFailed
OpenFailed4
bra.s OpenFailed
OpenFailed5
lea err5(pc),a0
bra.s doerr
OpenFailed6
lea err6(pc),a0
bra.s doerr
OpenFailed7
lea err7(pc),a0
bra.s doerr
OpenFailed9
lea err9(pc),a0
bra.s doerr
OpenFailed10
lea err10(pc),a0
bra.s doerr
OpenFailed11
lea err11(pc),a0
bra.s doerr
OpenFailed12
lea err12(pc),a0
bra.s doerr
OpenFailed13
lea err13(pc),a0
bra.s doerr
; Show error message
nop
doerr bsr.s doreq
bra OpenFailed
doreq movem.l d0-a6,-(a7)
move.l conIntBase(a2),a6
lea easyreq(pc),a1
move.l a0,es_TextFormat(a1)
suba.l a0,a0
suba.l a2,a2
suba.l a3,a3
jsr -588(a6) ;EasyRequestArgs
movem.l (a7)+,d0-a6
rts
*
* The CloseScreen routine
* a0: Taglist with input parameters
* a1: Taglist with output parameters
* a2: Context pointer (never NULL)
* a6: Base of utility.library
*
MyCloseScreen
movem.l d2-d7/a2-a6,-(sp)
; Close the screen
move.l conScreen(a2),d0
beq.s NoScreen
move.l d0,a0
move.l conIntBase(a2),a6
jsr -66(a6) ;CloseScreen
NoScreen
; Close dos.library
move.l conDOSBase(a2),d0
beq.s nodos
move.l d0,a1
move.l 4,a6
jsr -414(a6) ;CloseLibrary
nodos
; Close graphics.library
move.l conGfxBase(a2),d0
beq.s nogfx
move.l d0,a1
move.l 4,a6
jsr -414(a6) ;CloseLibrary
nogfx
; Close intuition.library
move.l conIntBase(a2),d0
beq.s noint
move.l d0,a1
move.l 4,a6
jsr -414(a6) ;CloseLibrary
noint
; Close expansion.library
move.l conExpBase(a2),d0
beq.s noexp
move.l d0,a1
move.l 4,a6
jsr -414(a6) ;CloseLibrary
noexp
; Free context
move.l 4,a6
move.l a2,a1
jsr -690(a6) ;FreeVec
CloseDone movem.l (sp)+,d2-d7/a2-a6
moveq #0,d0
rts
; Library names
UtilityName dc.b "utility.library",0
IntName dc.b "intuition.library",0
GfxName dc.b "graphics.library",0
DOSName dc.b "dos.library",0
ExpName dc.b "expansion.library",0
; The name of our screen
ScreenName dc.b "ShapeShifter Screen",0
CNOP 0,4
; Taglist for OpenScreen()
ScreenTags dc.l SA_Depth
ScrDepth dc.l 0
dc.l SA_Width
ScrWidth dc.l 0
dc.l SA_Height
ScrHeight dc.l 0
dc.l SA_DisplayID
ScrDisplayID dc.l 0
dc.l SA_Overscan
ScrOverscan dc.l 0
dc.l SA_Quiet,-1
dc.l SA_Exclusive,-1
dc.l SA_Title,ScreenName
dc.l TAG_END,0
; Bad news...
easyreq dc.l EasyStruct_SIZEOF
dc.l 0
dc.l er1
dc.l 0
dc.l er2
er1 dc.b "SD64evd_TEST Problem:",0
er2 dc.b "Bye!",0
err1
err2
err3
err4
err5 dc.b "You must set color depth 24 bit",0
err6 dc.b "Can't find TagItem RefreshType",0
err7
err8
err9 dc.b "OpenScreen failed",0
err10 dc.b "Can't find TagItem ScreenBase",0
err11 dc.b "Can't find TagItem BytesPerRow",0
err12 dc.b "Can't open expansion.library",$a
dc.b "Are you sure you are using an Amiga?",0
err13 dc.b "You don't have a PiccoloSD64",$a
dc.b "or your board has some problems",0
END